﻿<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:v="clr-namespace:ShredTheLog.Views;assembly=ShredTheLog.Views"
    xmlns:vm="clr-namespace:ShredTheLog.ViewModels;assembly=ShredTheLog.ViewModels"
    xmlns:cnv="clr-namespace:ShredTheLog.Converters;assembly=ShredTheLog.Converters"
    xmlns:c="clr-namespace:ShredTheLog.Controls;assembly=ShredTheLog.Controls"
    >

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="FlashMisc2.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <DataTemplate DataType="{x:Type vm:UserProfileViewModel}">
        <DataTemplate.Resources>
            <Style x:Key="Space" TargetType="{x:Type TextBlock}">
                <Setter Property="Text" Value=" "/>
            </Style>
            <Style x:Key="Colon" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource Space}">
                <Setter Property="Text" Value="·"/>
                <Setter Property="FontWeight" Value="Bold"/>
                <Setter Property="Margin" Value="3, 0, 3, 0"/>
            </Style>
            <Style x:Key="LanguagesTitle" TargetType="{x:Type TextBlock}">
                <Setter Property="Foreground" Value="#9480A8"/>
                <Setter Property="Margin" Value="3, 0, 0, 0"/>
            </Style>
            <Style x:Key="BorderedLine" TargetType="{x:Type Border}">
                <Setter Property="Background" Value="#E0E8F8"/>
                <Setter Property="BorderThickness" Value="1"/>
                <Setter Property="BorderBrush" Value="#C0C0C0"/>
                <Setter Property="Padding" Value="3, 0, 3, 0"/>
            </Style>
        </DataTemplate.Resources>

        <DockPanel Background="{StaticResource LightGrayBackgroundBrush}">
            <DockPanel DockPanel.Dock="Top">
                <ContentPresenter DockPanel.Dock="Left" Content="{Binding Gender}"/>
                <TextBlock DockPanel.Dock="Left" Style="{StaticResource Space}"/>
                <TextBlock Foreground="#285DB7" FontSize="15" FontWeight="Bold" TextTrimming="CharacterEllipsis">
                    <TextBlock.Text>
                        <MultiBinding StringFormat="{}{0:s} ({1:d})">
                            <Binding Path="Name" Mode="OneWay"/>
                            <Binding Path="Age" Mode="OneWay"/>
                        </MultiBinding>
                    </TextBlock.Text>
                </TextBlock>
            </DockPanel>

            <Border DockPanel.Dock="Top" Style="{StaticResource BorderedLine}">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Column="0" TextTrimming="CharacterEllipsis" Text="{Binding Path=Country, Converter={x:Static cnv:CountryConverter.Default}}"/>
                    <TextBlock Grid.Column="1" TextTrimming="CharacterEllipsis" Style="{StaticResource Colon}"/>
                    <TextBlock Grid.Column="2" TextTrimming="CharacterEllipsis" Text="{Binding Location}"/>
                    <TextBlock Grid.Column="3" TextTrimming="CharacterEllipsis" Text="{Binding Path=RegistrationDate, StringFormat=\{0:d\}}"/>
                </Grid>
            </Border>

            <DockPanel DockPanel.Dock="Top">
                <TextBlock DockPanel.Dock="Left" Text="{c:LocalizedString s_Knows}" Style="{StaticResource LanguagesTitle}"/>
                <TextBlock DockPanel.Dock="Left" Style="{StaticResource Colon}"/>
                <TextBlock Text="{Binding Path=KnownLanguages, Converter={x:Static cnv:LanguagesConverter.Default}}" TextTrimming="CharacterEllipsis"/>
            </DockPanel>

            <DockPanel DockPanel.Dock="Top">
                <TextBlock DockPanel.Dock="Left" Text="{c:LocalizedString s_Learns}" Style="{StaticResource LanguagesTitle}"/>
                <TextBlock DockPanel.Dock="Left" Style="{StaticResource Colon}"/>
                <TextBlock Text="{Binding Path=PracticingLanguages, Converter={x:Static cnv:LanguagesConverter.Default}}" TextTrimming="CharacterEllipsis"/>
            </DockPanel>

            <Border DockPanel.Dock="Top" Style="{StaticResource BorderedLine}">
                <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
                    <TextBlock>
                            <TextBlock.Style>
                                <Style TargetType="{x:Type TextBlock}">
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding ExchangesEmails}" Value="True">
                                            <Setter Property="Text" Value="{c:LocalizedString s_Emails}"/>
                                            <Setter Property="Foreground" Value="#258853"/>
                                        </DataTrigger>
                                        <DataTrigger Binding="{Binding ExchangesEmails}" Value="False">
                                            <Setter Property="Text" Value="{c:LocalizedString s_Emails}"/>
                                            <Setter Property="Foreground" Value="#B30053"/>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </TextBlock.Style>
                    </TextBlock>
                    <TextBlock Style="{StaticResource Colon}"/>
                    <TextBlock Text="{c:LocalizedString s_Chats}">
                            <TextBlock.Style>
                                <Style TargetType="{x:Type TextBlock}">
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding ChatsOnline}" Value="True">
                                            <Setter Property="Text" Value="{c:LocalizedString s_Chats}"/>
                                            <Setter Property="Foreground" Value="#258853"/>
                                        </DataTrigger>
                                        <DataTrigger Binding="{Binding ChatsOnline}" Value="False">
                                            <Setter Property="Text" Value="{c:LocalizedString s_Chats}"/>
                                            <Setter Property="Foreground" Value="#B30053"/>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </TextBlock.Style>
                    </TextBlock>
                </StackPanel>
            </Border>

            <Grid>
                <FlowDocumentScrollViewer VerticalScrollBarVisibility="Auto" Document="{Binding Path=Description, Converter={x:Static vm:UserDescriptionConverter.Default}}" c:Extensions.UnbindDocumentWhenSettingsUpdated="True"/>
                <ProgressBar Width="32" Height="32" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" Visibility="{Binding Path=IsLoading, Converter={StaticResource BoolToVisibilityConverter}}"/>
            </Grid>
        </DockPanel>
    </DataTemplate>
</ResourceDictionary>